﻿@using DIS.Infrastructure.Entities.Entity;
@using DIS.Infrastructure.Entities.Enum;
@{
    ViewBag.Title = "新增周期";
    Layout = "~/Views/Shared/_Layout.cshtml";

    FinancialPeriod fp = ViewBag.Fp;
    List<string> yearList = ViewBag.yearList;
}

<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D6D6D6">
        <tr>
            <td height="19" background="/content/img/tbg.gif" bgcolor="#E7E7E7">
                <table width="96%" border="0" cellspacing="1" cellpadding="1">
                    <tr>
                        <td style="padding-left: 10px;">
                            <b><strong>添加周期</strong></b>
                        </td>
                        <td align="right">
                            <b><strong><a href="/systemset/FinancialPeriod">周期列表</a></strong></b>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="center" valign="top" bgcolor="#FFFFFF">
                <form name="saveuserForm" action="/systemset/SaveFinancialPeriod" method="post">
               
                @{
                    if (fp != null)
                    {
                         <input type="hidden" name="Id" id="id" value="@fp.Id" />
                        <table width="98%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="16%" height="30" align="right">
                            <span class='red'>*</span>年：
                        </td>
                        <td width="84%" style="text-align: left;">
                        <select name='year' style="width: 210px">
                            @{
                        if (yearList != null && yearList.Count > 0)
                        {
                            foreach (var item in yearList)
                            {
                                if (fp.Year == item)
                                {
                                    <option value="@item" selected>@item</option>
                                }
                                else
                                {
                                    <option value="@item">@item</option>
                                }
                            }
                        }
                    }
                    </select>
                            
                        </td>
                    </tr>
                    <tr>
                        <td width="16%" height="30" align="right">
                            <span class='red'>*</span>月：
                        </td>
                        <td width="84%" style="text-align: left;">
                            <select name='month' style="width: 210px">
                            @{
                        for (int j = 1; j < 13; j++)
                        {
                            string item = j.ToString().PadLeft(2, '0');
                            if (fp.Month == item)
                            {
                                <option value="@item" selected>@item</option>
                            }
                            else
                            {
                            <option value="@item">@item</option>
                            }
                        }
                    }
                                  
                             </select>
                        </td>
                    </tr>
                     
                    <tr>
                        <td width="16%" height="30" align="right">
                            <span class='red'>*</span>开始日期：
                        </td>
                        <td width="84%" style="text-align: left;">
                            <input name="startDate" type="text" id="startDate" readonly="readonly" value="@fp.StartDate" size="16" style="width: 200px" onClick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" />
                        </td>
                    </tr>
                     <tr>
                        <td width="16%" height="30" align="right">
                            <span class='red'>*</span>结束日期：
                        </td>
                        <td width="84%" style="text-align: left;">
                            <input name="endDate" type="text" id="endDate" readonly="readonly" value="@fp.EndDate" size="16" style="width: 200px" onClick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" />
                        </td>
                    </tr>
                     
                    <tr> 
            <td height="60">&nbsp;</td>
            <td align="left">
            	<input type="submit" name="submit" value="保存" class="coolbg np" />
            </td>
          </tr>
                </table>
                    }
                    else
                    {
                         <input type="hidden" name="Id" id="id" value="0" />
                        <table width="98%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="16%" height="30" align="right">
                            <span class='red'>*</span>年：
                        </td>
                        <td width="84%" style="text-align: left;">
                            <select name='year' style="width: 210px">
                            @{
                        if (yearList != null && yearList.Count > 0)
                        {
                            int year=DateTime.Now.Year;
                            foreach (var item in yearList)
                            {
                                if (item == year.ToString())
                                {
                                    <option value="@item" selected>@item</option>
                                }
                                else
                                {
                                    <option value="@item">@item</option>
                                }
                            }
                        }
                    }
                    </select>
                        </td>
                    </tr>
                    <tr>
                        <td width="16%" height="30" align="right">
                            <span class='red'>*</span>月：
                        </td>
                        <td width="84%" style="text-align: left;">
                            <select name='month' style="width: 210px">
                                  @{
                        for (int j = 1; j < 13; j++)
                        {
                            string month = DateTime.Now.Month.ToString().PadLeft(2,'0');
                            string item = j.ToString().PadLeft(2, '0');
                            if (month == item)
                            {
                                <option value="@item" selected>@item</option>
                            }
                            else
                            {
                            <option value="@item">@item</option>
                            }

                        }
                    }
                             </select>
                        </td>
                    </tr>
                    
                    <tr>
                        <td width="16%" height="30" align="right">
                            <span class='red'>*</span>开始日期：
                        </td>
                        <td width="84%" style="text-align: left;">
                            <input name="startDate" type="text" id="startDate" readonly="readonly" size="16" style="width: 200px" onClick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" />
                        </td>
                    </tr>
                    <tr>
                        <td width="16%" height="30" align="right">
                            <span class='red'>*</span>结束日期：
                        </td>
                        <td width="84%" style="text-align: left;">
                            <input name="endDate" type="text" id="endDate" readonly="readonly" size="16" style="width: 200px" onClick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" />
                        </td>
                    </tr>
                     
                    <tr> 
            <td height="60">&nbsp;</td>
            <td align="left">
            	<input type="submit" name="submit" value="保存" class="coolbg np" />
            </td>
          </tr>
                </table>
                    }
                }
                
                </form>
            </td>
        </tr>
    </table>
